package main

import (
	"flag"
	"fmt"
)

// flag.Type(flag 名, 默认值, 帮助信息) *Type
//https://blog.csdn.net/weixin_46272577/article/details/124511421
func main() {
	// 返回的name,age,married,delay等为对应类型的指针
	name := flag.String("name", "张三", "姓名")
	age := flag.Int("age", 18, "年龄")
	married := flag.Bool("married", false, "婚否")
	delay := flag.Duration("d", 0, "时间间隔")

	// 设置好之后命令解析
	flag.Parse()

	// 返回的是指针，访问需使用*
	fmt.Println(*name, *age, *married, *delay)
}
